//
// Created by FindBin on 2023/12/21.
//

#include "UPRE_AirCylinder.h"
#include "stdarg.h"
#include "i2c.h"

void setAirCylinder(uint8_t airID, uint8_t Command, uint8_t Queue) {
    uint8_t Rx = (Command & Queue);
    HAL_I2C_Master_Transmit(&Air_I2C, airID, &Rx, 1, HAL_MAX_DELAY);
}

void setAirCylinder_more(uint8_t airID, uint8_t Command, uint8_t size, ...) {
    if (size > 8) {
        Error_Handler();
        return;
    }
    va_list vaList;
    va_start(vaList, size);
    for (int i = 0; i < size; i++) {
        uint8_t arg = va_arg(vaList, uint32_t);
        uint8_t Rx = (Command & arg);
        HAL_I2C_Master_Transmit(&Air_I2C, airID, &Rx, 1, HAL_MAX_DELAY);
    }
    va_end(vaList);
}


